package com.eightbears.beboy.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eightbears.beboy.R;
import com.eightbears.beboy.base.util.CommonUtils;
import com.eightbears.beboy.entity.HomeListEntity;

public class BuyPostListAdapter extends BaseQuickAdapter<HomeListEntity.Post, BaseViewHolder> {

    public BuyPostListAdapter() {
        super(R.layout.item_buy_post, null);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, HomeListEntity.Post homeListEntity) {

        if (null != homeListEntity.getImages())
            CommonUtils.loadImageView(mContext, homeListEntity.getImages().get(0),
                    R.mipmap.default_icon, (ImageView) baseViewHolder.getView(R.id.iv_shop_icon));
        baseViewHolder.setText(R.id.tv_shop_name, homeListEntity.getShop())
                .setText(R.id.tv_shop_address, homeListEntity.getAddress())
                .setText(R.id.tv_shop_phone, homeListEntity.getContact())
                .addOnClickListener(R.id.cv_root);

    }
}
